<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/5
 * Time: 11:28
 */

header("Content-Type: text/html;charset=utf-8");
header("Access-Control-Allow-Origin:*");

include "config.php";

if(isset($_REQUEST["uname"])){

    $UNAME = $_REQUEST["uname"];

    //1. 准备sql已经
    $sql = "SELECT * FROM sasauserinfo WHERE u_name=?";
    // 预处理sql语句里的 ?
    $stmt = $conn->prepare($sql);
    //参数化查询
    // s  string
    // i  int
    //2.给?绑定参数
    $stmt->bind_param("s", $UNAME);
    //3.执行
    $stmt->execute();
    //4.取得结果
    $result = $stmt->get_result();

    //5.判断结果
    if($result->num_rows>=1){
        print_r("false");

    }else{
        print_r("true");
    }

}

